/
Assembly List
/
LJCNetCommon
/
NetString
/ GetStringWithDelimiters
Namespace - LJCNetCommon
Parameters
text - The text value.
beginDelimiter - The beginning delimiter.
startIndex - The starting index.
endDelimiter - The ending delimiter.
Returns
The text including the specified delimiters.
Syntax
C# |
public static String GetStringWithDelimiters(String text, String beginDelimiter, Int32& startIndex, String endDelimiter = null)
|
Get the string including the specified delimiters.
Example
C# |
using LJCNetCommon;
private static void GetStringWithDelimiters()
{
var source = "<summary>This is some text.</summary>";
var startIndex = 0;
var beginDelimiter = "<summary>";
var endDelimiter = "</summary>";
var text = NetString.GetStringWithDelimiters(source, beginDelimiter
, ref startIndex, endDelimiter);
source = "|This is some text.|";
startIndex = 0;
beginDelimiter = "|";
text = NetString.GetStringWithDelimiters(source, beginDelimiter
, ref startIndex);
source = "|This is some text.";
startIndex = 0;
beginDelimiter = "|";
text = NetString.GetStringWithDelimiters(source, beginDelimiter
, ref startIndex, "#NoDelimiter");
source = "|This is some text.| |and some more here.|";
startIndex = 0;
beginDelimiter = "|";
while (startIndex > -1)
{
text = NetString.GetStringWithDelimiters(source, beginDelimiter
, ref startIndex);
}
}
|
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.